#ifndef     __DEVICE_INFO_H
#define     __DEVICE_INFO_H

#include "../utils/cargo.h"
#include "../utils/object.h"
#include "../utils/no_copyable.h"
#include "../driver/spi_flash.h"
#include "../utils/error.h"
#include "../utils/message.h"

namespace service {

class DeviceInfo : utils::no_copyable_t {

public:
    DeviceInfo();

    void for_each(void (*f) (const utils::cargo_t &info));
    void notify_info(const utils::message_t &msg); 
    utils::error_t change_or_add_cargo(const utils::cargo_t &cargo);
    void set_pick_info(uint16_t depth);
    void set_pick_info(uint16_t p1, uint16_t p2, uint16_t depth);
    void get_pick_info(uint16_t &p1, uint16_t &p2, uint16_t &depth);
    utils::error_t get_by_cargo(utils::cargo_t &cargo);
    uint32_t get_cargo_count();    
    utils::error_t del_cargo(const utils::cargo_t &cargo);
};

inline utils::object_t<DeviceInfo> deviceInfo;

}

#endif
